package com.atguigu.gmall.gateway.config;


import com.atguigu.gmall.common.utils.RsaUtils;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import javax.annotation.PostConstruct;
import java.io.File;
import java.security.PrivateKey;
import java.security.PublicKey;

@ConfigurationProperties(prefix = "auth.jwt")
@Data
public class JwtProperties {
    private String pubKeyPath;//: D:\rsa\rsa.pub
    private String cookieName;//: GMALL-TOKEN


    private PublicKey publicKey;

    
    @PostConstruct
    public void init(){
        try {
            File pubFile = new File(pubKeyPath);
            //读取公钥
          this.publicKey=  RsaUtils.getPublicKey(pubKeyPath);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }


}
